package com.learning.spring.cloud.ms.consumer.movie;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * ClassName: MsConsumerMovieApplication
 * Description:
 * Date: 2019/5/31 10:42 【需求编号】
 * <p>
 * hystrix 熔断需要注解：@EnableHystrix 或者 @EnableCircuitBreaker 。
 * 注解 @EnableHystrix 组合了 @EnableCircuitBreaker
 *
 * @author Sam Sho
 * @version V1.0.0
 */
@EnableHystrix
@SpringBootApplication
public class MsConsumerMovieApplication {

    public static void main(String[] args) {
        SpringApplication.run(MsConsumerMovieApplication.class, args);
    }

    /**
     * Ribbon 客户端负载，需要添加 @LoadBalanced 注解
     *
     * @return
     */
    @LoadBalanced
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

}
